Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create new index for tracking Asset metadata #2445

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

maschad
Copy link
Member

@maschad maschad commented Nov 20, 2024

Linked Issues/PRs

Description

This introduces a new GraphQL endpoint that returns info about an asset.

The off-chain worker indexes Mint and Burn events to store this metadata about an AssetId

Checklist

  • New behavior is reflected in tests

Before requesting review

  • I have reviewed the code myself

After merging, notify other teams

[Add or remove entries as needed]

@maschad maschad self-assigned this Nov 20, 2024
}

#[tokio::test]
#[ignore] // TODO: Need to be able to mint assets for this test to work
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not quite sure how to enable permissions to be able to mint assets for the purposes of this test

@maschad maschad requested a review from xgreenx November 22, 2024 20:41
@maschad maschad marked this pull request as ready for review November 22, 2024 20:41
Copy link
Contributor

@AurelienFT AurelienFT left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we need the test to be working before merging this.

Comment on lines +400 to +401
.checked_sub(*val)
.ok_or(anyhow::anyhow!("Asset count overflow"))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible that if we start indexing from now and not the past we end-up with a fail here because we would find a burn on a token with 0 (because we saw no mint before) ?

let burn_amount = 50;

// Mint coins first
let mint_tx = TransactionBuilder::mint(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is not how you mint assets. From the spec : https://github.com/FuelLabs/fuel-specs/blob/master/src/tx-format/transaction.md#transactionmint this transaction is only used by the block producer that's why it's not accepted in the pool.
It's currently used for block rewards I think and it has this much fields for future usage.
However I don't know how to mint asset with the Native assets I never used it but I think it should be that way that you should mint your coins (using script or calls). Maybe someone else in the @FuelLabs/client has more details.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add indexation AssetId -> (ContractId, SubId)
3 participants